<?php
  session_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="html/text; charset=utf-8" />
<title>简易BBS系统</title>
</head>
<body>
<?php
include "head.php";
include "mysql.php";
include "myfunction.php";
$aa=new mysql;
$aa->link("");
$bb=new myfunction;
include "total_info.php";
$module_id=$_GET["module_id"];
$del_id=$_GET["del_id"];

if($_SESSION["user_name"]==$bb->son_module_idtouser_name($module_id)){
    if($del_id != '')   {
        $query="delete  from note_info where id = $del_id";
        $rst=$aa->excu($query);
	echo "删除帖子成功";
    }
}

  $query="select * from note_info where module_id='$module_id' order by time desc";
  $add="module_id=".$module_id."&";
 
?>
<table width="98%" border="0" align="center" cellspacing="0"  cellpadding="0">
<tr>
 <td width="60%" height="15" ><?php
 echo "<a href='indexs.php'>简易BBS系统</a>>><a href='indexs.php'>".$bb->
       son_module_idtofarther_name($module_id)."</a>>>";
 echo $bb->son_module_idtomodule_name($module_id);
 ?>
 </td>
 <td height="15" width="40%" align="right"><a href="new_note.php">发新帖子</a></td>
 </tr>
 <tr>
  <td height="15" colspan="2"><?php
  $bb->page($query,$add,$page_id,20); ?>
  </td>
 </tr>
 </table>
 <table width="98%" border="0" cellspacing="1" cellpadding="0" align="center">
  <tr>
   <td height="15" bgcolor="#000000" width="2%"></td>
   <td height="15" bgcolor="#000000" width="4%"><font color="#FFFFFF">人气</font></td>
   <td height="15" bgcolor="#000000" width="32%"><font color="#FFFFFF">标题</font></td>
   <td height="15" bgcolor="#000000" width="20%"></td>
   <td height="15" bgcolor="#000000" width="8%"><font color="#FFFFFF">发起人</font></td>
   <td height="15" bgcolor="#000000" width="4%"><font color="#FFFFFF">帖子数</font></td>
   <td height="15" bgcolor="#000000" width="20%"><font color="#FFFFFF">最后发表时间</font></td>
   <td height="15" bgcolor="#000000" width="10%"><font color="#FFFFFF">最后发表人</font></td>
  </tr>
  <?php
   $rst=$aa->excu($query);
   while($note=mysql_fetch_array($rst)){
  ?>
  <tr>
   <td height="15"  width="2%"></td>
   <td height="15"  width="4%"><?php echo $bb->note_idtotimes($note["id"]) ?></td>
   <td height="15" width="32%"><?php
        echo "<a href=note_show.php?module_id=".$module_id."&note_id=".$note["id"].">".$bb->note_idtotitle($note["id"])."</a>";
        ?>
    <td height="15" width="20%"><?php
             if($_SESSION["user_name"]==$bb->son_module_idtouser_name($module_id))
             {
        	   echo "&nbsp;&nbsp;&nbsp;&nbsp;<a href=son_module_list.php?module_id=".$module_id."&page_id=".$page_id."&del_id=".$note["id"].">删除此贴</a>";
              }
                       ?>
   </td>
   <td height="15" width="8%"><?php
        echo $bb->note_idtouser_name($note["id"]);
         ?></td>
   <td height="15"  width="4%"><?php echo $bb->note_idtonum($note["id"]) ?></td>
   <td height="15"  width="20%"><?php echo $bb->note_idtolast_time($note["id"]) ?></td>
   <td height="15" width="10%"><?php echo $bb->note_idtolast_user($note["id"]) ?></td>
  </tr>
  <?php } ?>
  <tr>
   <td height="15" colspan="7" align="right" ><?php
       $query="select * from note_info where module_id='$module_id'";
       $add="module_id=".$module_id."&";
       $bb->page($query,$add,$page_id,20);
       ?>
   </td>
  <tr>
  </table>
  <?php
   include "foot.php";
  ?>
  </body>
  </html>




















